<div nz-row>
    <div nz-col nzSpan="12">
        <h1 *ngIf="!app">新建应用</h1>
        <h1 *ngIf="app">编辑应用</h1>
    </div>
</div>
<nz-spin [nzSpinning]="isSpinning">

    <div nz-row>
        <div nz-col nzSpan="24">
            <form nz-form [formGroup]="form" (ngSubmit)="submitForm()">
                <nz-form-item>
                    <nz-form-control nzSpan="6">
                        <nz-input-group>
                            <input type="text" nz-input formControlName="appName" placeholder="请输入应用名" trim="blur"
                                   nz-tooltip nzTooltipPlacement="right" nzTitle="应用名" autofocus/>
                        </nz-input-group>
                    </nz-form-control>
                </nz-form-item>

                <nz-form-item>
                    <nz-form-control nzSpan="6">
                        <nz-input-group>
                            <input type="text" nz-input formControlName="appCode" placeholder="请输入应用编号" trim="blur"
                                   nz-tooltip nzTooltipPlacement="right" nzTitle="应用编号"/>
                        </nz-input-group>
                    </nz-form-control>
                </nz-form-item>

                <nz-form-item nz-row class="register-area">
                    <nz-form-control [nzSpan]="14">
                        <button nz-button nzType="primary">保存</button>
                    </nz-form-control>
                </nz-form-item>
            </form>
        </div>
    </div>


    <div nz-row *ngIf="result.envList.length == 0">
        <div nz-col nzSpan="12">
            <h1>当前还没有环境，点击 <a routerLink="/env/new">创建</a></h1>
        </div>
    </div>

    <div nz-row *ngIf="result.envList.length > 0">
        <div nz-col nzSpan="12">
            <nz-tabset>
                <nz-tab *ngFor="let item of result.envList" [nzTitle]="item.envName">
                    <ng-container *ngIf="item.configList.length > 0">
                        <nz-checkbox-group [(ngModel)]="item.configList"></nz-checkbox-group>
                    </ng-container>
                    <ng-container *ngIf="item.configList.length == 0">
                        当前还没有配置，点击去 <a [routerLink]="'/conf/new/'+item.envId">创建</a>
                    </ng-container>
                    <h1 class="mt20">
                        配置示例
                        <button nz-button nzType="primary" (click)="copyInputMessage(configText)">复制</button>
                    </h1>
                    <!--@formatter:off-->
<textarea nz-input [nzAutosize]="{ minRows: 10, maxRows: 20 }" #configText>
spring.application.name={{ param.project.projectCode }}_{{ form.get('appCode').value }}
spring.profiles.active={{ item.envCode }}
spring.cloud.config.uri=http://localhost:8888/api/config-server
</textarea>
<!--@formatter:on-->
                </nz-tab>
            </nz-tabset>
        </div>
    </div>


</nz-spin>
